'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 1_study_model.py
* @Time: 2025/7/10
* @All Rights Reserve By Brtc
'''
from datetime import datetime

import dotenv
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI

# 加载环境
dotenv.load_dotenv()

#1、编排prompt
prompt = ChatPromptTemplate.from_messages([
    ("system", "你是OpenAI 开发的机器人，请回答用户的问题，现在的时间是{now}"),
    ("human", "{query}")
]).partial(now = datetime.now())

# 2、创建大语言模型
llm = ChatOpenAI(model = "gpt-3.5-turbo-16k")

ai_message = llm.invoke(prompt.invoke({"query":"给我一个json数据, 键为a和b，值为任意的整型。除了json数据，其他内容均不要返回。"}))
print(ai_message.type)
print(ai_message.content)
print(ai_message.response_metadata)

